package com.projectx.action.chat;

import android.content.Context;
import android.content.Intent;

import androidx.appcompat.app.AppCompatActivity;

/**
 * 检查是否为合法的聊天请求，选择单人或者群聊
 */

public class SwitchChat{
    /**
     *
     * @param username
     * @param targetName
     * @param isGroup
     * @param context
     */
    public static void startChat(Context context, String username, String targetName, boolean isGroup){
        Intent intent;
        if (isGroup){
            intent = new Intent(context,GroupChatActivity.class);
        } else {
            intent = new Intent(context,SingleChatActivity.class);
        }
        intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
        intent.putExtra("accountName",username);
        intent.putExtra("targetName",targetName);
        context.startActivity(intent);
    }
}
